package o;

import android.content.Context;
import android.util.Log;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;

class avo extends avp {
    private SecretKey ˋ;
    private final Object ˏ = new Object();
    private final Map<String, String> ॱ = new HashMap();

    avo(Context context) {
        super(context);
        try {
            this.ˋ = avq.ˋ(avn.ॱ(ॱ("/AD91D45E3E72DB6989DDCB13287E75061FABCB933D886E6C6ABEF0939B577138")), avn.ॱ(ॱ("/B314B3BF013DF5AC4134E880AF3D2B7C9FFBE8F0305EAC1C898145E2BCF1F21C")), avn.ॱ(ॱ("/C767BD8FDF53E53D059BE95B09E2A71056F5F180AECC62836B287ACA5793421B")), avn.ॱ(ॱ("/DCB3E6D4C2CF80F30D89CDBC412C964DA8381BB84668769391FBCC3E329AD0FD")));
        } catch (Exception e) {
            Log.e("SecurityResourcesReader", "Exception when reading the 'K&I' for 'Config'.");
            this.ˋ = null;
        }
    }

    public String ˎ(String str, String str2) {
        if (this.ˋ == null) {
            return str2;
        }
        synchronized (this.ˏ) {
            String str3 = (String) this.ॱ.get(str);
            if (str3 != null) {
                return str3;
            }
            String ॱ = ॱ(str);
            if (ॱ == null) {
                return str2;
            }
            try {
                str3 = new String(ˊ(this.ˋ, avn.ॱ(ॱ)), "UTF-8");
                this.ॱ.put(str, str3);
                return str3;
            } catch (Exception e) {
                Log.e("SecurityResourcesReader", "Exception when reading the 'V' for 'Config'.");
                return str2;
            }
        }
    }

    private String ॱ(String str) {
        return super.ˎ(str, null);
    }

    private static byte[] ˊ(SecretKey secretKey, byte[] bArr) throws GeneralSecurityException {
        if (secretKey == null || bArr == null) {
            throw new NullPointerException("key or cipherText must not be null.");
        }
        byte[] copyOfRange = Arrays.copyOfRange(bArr, 1, 17);
        Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding");
        instance.init(2, secretKey, new IvParameterSpec(copyOfRange));
        return instance.doFinal(bArr, copyOfRange.length + 1, (bArr.length - copyOfRange.length) - 1);
    }
}
